﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MediatR;
using BasicInformationCommon.API.BasicInformationCommons.CustomerProfileesReads;
using ERPSystem.Common.Domains.CustomerProfileCommon;
using ERPSystem.Common.DTO;
using ERPSystem.Enum.CommonErrorCodes;
using SqlSugar;
using BasicInformationCommon.API.BasicInformationCommons.DropDownCommon.ClientTypeRead;
using BasicInformationCommon.API.BasicInformationCommons.DropDownCommon.CreditRatingRead;
using BasicInformationCommon.API.BasicInformationCommons.DropDownCommon.ProvinceCityRead;

namespace BasicInformationCommon.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CustomerProfileReadesController : ControllerBase
    {
        private readonly IMediator _mediator;

        public CustomerProfileReadesController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 查询客户档案信息业务逻辑
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result<PageResultDto<CustomerProfileQueryDto>>> CustomerProfileQuery([FromQuery]CustomerProfileQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询客户分类
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> ClientTypeQuery([FromQuery]ClientTypeQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询信用等级
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> CreditRatingQuery([FromQuery]CreditRatingQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询省市
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> ProvinceCityQuery([FromQuery]ProvinceCityQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
    }
}
